-
Notifications
You must be signed in to change notification settings - Fork 4
chore: migrate from Ladle to Storybook #930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on: |
|
@SocketSecurity ignore npm/[email protected] |
|
@SocketSecurity ignore npm/[email protected] |
f9719b1 to
13bc3b5
Compare
- Replace @ladle/react with Storybook 8.6.15 - Convert all 69 story files from Ladle's Story<T> format to Storybook CSF3 - Add .storybook/ configuration with providers, component adapter toolbar - Migrate helpers: FormWrapper, PlainComponentAdapter, add useStoryState - Update tsconfig.json, vite.config.ts, eslint.config.mjs for .storybook paths - Update CONTRIBUTING.md with Storybook instructions - Add storybook-static/ and *storybook.log to .gitignore
13bc3b5 to
121d889
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR successfully migrates the SDK's component development environment from Ladle to Storybook 8.6.15, maintaining a 1:1 functional parity while adopting a more widely-supported tooling ecosystem. The migration includes configuration setup, helper utilities, and conversion of 69 story files from Ladle's format to Storybook's CSF3 format.
Key changes:
- Replaced Ladle with Storybook 8.6.15 and configured addons (essentials, interactions, a11y, dark mode)
- Migrated all story files from
action()tofn().mockName()pattern - Converted
useLadleStatetouseStoryStatefor state management in stories - Updated component adapter toggle from floating button to Storybook toolbar
Reviewed changes
Copilot reviewed 73 out of 78 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.storybook/main.ts |
Storybook configuration with Vite integration and addon setup |
.storybook/preview.tsx |
Global decorators with providers and component adapter toolbar |
.storybook/helpers/* |
Migrated helper utilities (FormWrapper, useStoryState, MockBaseProvider) |
.storybook/adapters/PlainComponentAdapter.tsx |
Migrated plain HTML component adapter |
package.json |
Added Storybook dependencies, removed Ladle |
vite.config.ts |
Updated exclusion patterns from .ladle to .storybook |
tsconfig.json |
Updated path aliases from ~ladle/* to ~storybook/* |
eslint.config.mjs |
Added .storybook/**/* to ignores |
| 69 story files | Converted from Ladle format to Storybook CSF3 format |
.ladle/* |
Removed all Ladle configuration and helpers |
CONTRIBUTING.md |
Updated developer instructions to use Storybook |
.gitignore |
Added Storybook build output entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
serikjensen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good thanks for taking this on! left a few comments
| css: { | ||
| preprocessorOptions: { | ||
| scss: { | ||
| api: 'modern-compiler', | ||
| additionalData: `@use "@/styles/Helpers" as *; @use '@/styles/Responsive' as *;\n`, | ||
| }, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we import our codebase CSS config here so that changes to our codebase config don't result in breaking storybook?
.storybook/preview.tsx
Outdated
| <I18nextProvider i18n={SDKI18next}> | ||
| <LocaleProvider locale="en-US" currency="USD"> | ||
| <ThemeProvider> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These providers are already set in GustoProviderCustomUIAdapter. looks like you can just set the props on that and remove these?
| } | ||
|
|
||
| export default { | ||
| const meta: Meta<typeof BadgeWrapper> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: any reason this is getting changed to meta and then using the default export? Vs. the other default exports? just wondering since if there's a needed change here i'm not seeing it on the other exports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, i'll look into that one
Summary
This PR migrates the SDK's component development environment from Ladle to Storybook 8.6.15.
Goal
Port existing Ladle functionality to Storybook — this is NOT an effort to implement new Storybook features. The goal is a 1:1 migration that maintains our existing development workflow while moving to a more widely-adopted tool with better long-term support.
Testing
Used cursor + playwright MCP to get us to 100% matching between chromeless screenshots of stories
What Changed
Added
.storybook/configuration directory:main.ts— Story discovery patterns, addons, Vite configpreview.tsx— Global decorators with providers, component adapter toolbar togglehelpers/FormWrapper.tsx— Form wrapper with Storybook actions integrationhelpers/useStoryState.tsx— State management helper for interactive storieshelpers/MockBaseProvider.tsx— Mock provider for stories needing BaseContextadapters/PlainComponentAdapter.tsx— Plain HTML component adapter (migrated from Ladle)static/demo-images/— Static assets for stories@storybook/*8.6.15,storybook-dark-mode)storybook,build-storybook.gitignoreentries forstorybook-static/and*storybook.logModified
Story<T>format to Storybook CSF3 (Meta/StoryObj)tsconfig.json— Updated paths from.ladleto.storybookvite.config.ts— Updated exclusion patterns for.storybookeslint.config.mjs— Added.storybook/**/*to ignoresCONTRIBUTING.md— Updated developer instructions to usenpm run storybookpackage.json— Added Storybook deps, removed@ladle/reactRemoved
.ladle/directory and all Ladle configuration@ladle/reactdependencyladlenpm scriptWhat Did NOT Change
Verification
npm run tsc)npm run lint:check)npm run format:check)npm run test -- --run)npm run build)npm run build-storybook)This migration was largely AI-assisted. While all automated checks pass and manual spot-checks have been performed, reviewers should:
The risk is mitigated by:
How to Test
npm install npm run storybook # Visit http://localhost:6006